#ifndef ACTION_H_H_H_
#define ACTION_H_H_H_

#include <QAction>
class Command;
class Action : public QObject
{
	Q_OBJECT
public:
	Action(Command* pcCmd,QObject* parent = 0);
	Action(Command* pcCmd,QAction* action,QObject* parent);
	virtual~Action(void);

public:
	virtual void addTo(QWidget* w);
	virtual void setEnabled(bool);
	virtual void setVisible(bool);

	void setCheckble(bool);
	void setChecked(bool);
	bool isChecked()const;

	void setShortcut(const QString&);
	QKeySequence shortcut()const;
	void setIcon(const QIcon&);
	void setStausTip(const QString&);
    QString stausTip()const;
	void setText(const QString&);
	QString text()const;

	void setToolTip(const QString&);
	QString toolTip()const;

	void setWhatThis(const QString&);
	QString whatThis()const;

public Q_SLOTS:
		virtual void onActivated();
		virtual void OnToggled(bool);


protected:
	QAction* _action;
	Command* _pcCmd;
};

class ActionGroup : public Action
{
	Q_OBJECT
public:

	ActionGroup(Command* pcCmd,QObject* parent = 0);
	virtual ~ActionGroup();

	void addTo(QWidget* w);
	void setEnabled(bool);
	void setDisabled(bool);
	void setExclusive(bool);
	void setVisible(bool);

	void setDropDownMenu(bool b){_dropDown = b;}
	QAction* addAction(QAction*);
	QAction* addAction(const QString&);
	QList<QAction*>actions()const;
	int checkedAction()const;
	void setCheckedAction(int);

public Q_SLOTS:

	void onActivated();
	void onActivated(int);
	void onActivated(QAction*);

protected:

	QActionGroup* _group;
	bool         _dropDown;
};

#endif